import request from '@/utils/request'

/**
 * 获取部门列表
 */
export const getDepartmentApi = () => request({
  url: '/company/department'
})

/**
 * 获取部门列表负责人
 */
export const getManagerListApi = () => request.get('/sys/user/simple')

/**
 *  新增组织
 */
export const addDepartmentApi = (data) => request({
  method: 'post',
  url: '/company/department',
  data
})

/**
 * 根据部门id获取部门详情
 */
export const getDepartmentDetailApi = (id) => request({
  url: `/company/department/${id}`
})

/** *
 * 更新部门
 * ***/
export const updateDepartmentApi = (data) => request({
  method: 'put',
  url: `/company/department/${data.id}`,
  data
})

/** *
 * 删除部门
 * ***/
export const delDepartment = (id) => request({
  method: 'delete',
  url: `/company/department/${id}`
})

/** *
 * 获取角色列表
 * **/
export function getRoleListApi(params) {
  return request({
    url: '/sys/role',
    params // 查询参数
  })
}

/** *
 * 编辑员工列表
 * **/
export function updateEmployeeApi(data) {
  return request({
    url: `/sys/user/${data.id}`,
    method: 'put',
    data
  })
}
